﻿using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SmartCity.Shared;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;

namespace CommonManagement
{
    /// <summary>
    /// 余额控制器
    /// </summary>
    [RemoteService]
    [Area("commonManagement")]
    [Route("api/commonManagement/balances")]
    public class BalanceController : AbpController, IBalanceAppService
    {
        private readonly IBalanceAppService _balanceAppService;

        public BalanceController(
            IBalanceAppService balanceAppService)
        {
            _balanceAppService = balanceAppService;
        }

        // 1.3.1 金额变动记录
        [Authorize]
        [HttpGet]
        [Route("list")]
        public Task<ListResponse<BalanceDto>> PagedListAsync(PagedListRequest request)
        {
            return _balanceAppService.PagedListAsync(request);
        }

        // 1.3.2 充值
        [Authorize]
        [HttpPost]
        [Route("recharge")]
        public Task<ActionResponse> RechargeAsync(BalanceRechargeDto input)
        {
            return _balanceAppService.RechargeAsync(input);
        }
    }
}